lib: fix new clippy warnings
authorLuca BRUNO <luca.bruno@coreos.com>
Wed, 1 Dec 2021 15:13:57 +0000 (15:13 +0000)
committerColin Walters <walters@verbum.org>
Fri, 6 May 2022 16:53:57 +0000 (12:53 -0400)
This fixes the following warnings highlighted by clippy:
 * https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
 * https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
 * https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports

rust-bindings/rust/src/kernel_args.rs
rust-bindings/rust/src/object_details.rs
rust-bindings/rust/src/object_name.rs
rust-bindings/rust/src/repo.rs
rust-bindings/rust/src/sysroot.rs

index 94b41771140f6c5674e8cd888bfcfe58dff13419..ea7fc532fdebfb1626436a9268e1c1adf7de7ed1 100644 (file)
@@ -1,7 +1,5 @@
 use ffi::OstreeKernelArgs;
 #[cfg(any(feature = "v2019_3", feature = "dox"))]
-use gio;
-#[cfg(any(feature = "v2019_3", feature = "dox"))]
 use glib::object::IsA;
 use glib::translate::*;
 #[cfg(any(feature = "v2019_3", feature = "dox"))]
index fcf13d615dce4f65cb26622cda60924478264b3c..f6adcc812a48a22de072473eab14fc30afbfdf46 100644 (file)
@@ -1,4 +1,3 @@
-use glib;
 use std::fmt::Display;
 use std::fmt::Formatter;
 use std::fmt::Error;
index a69fee67998d79766e207d07278458cd7cffe651..06ff8045fd4126c90c492f957f49cdaf6b12f342 100644 (file)
@@ -1,6 +1,5 @@
 use crate::ObjectType;
 use crate::{object_name_deserialize, object_name_serialize, object_to_string};
-use glib;
 use glib::translate::*;
 use glib::GString;
 use std::fmt::Display;
index edec8dc5e0ebf2492cabd0c14e004a338442b0ce..6a44103bb2339ad980fcbc56f01337abb3aa7d1f 100644 (file)
@@ -1,7 +1,6 @@
 #[cfg(any(feature = "v2016_4", feature = "dox"))]
 use crate::RepoListRefsExtFlags;
 use crate::{Checksum, ObjectName, ObjectDetails, ObjectType, Repo, RepoTransactionStats};
-use ffi;
 use ffi::OstreeRepoListObjectsFlags;
 use glib::ffi as glib_sys;
 use glib::{self, translate::*, Error, IsA};
@@ -117,7 +116,7 @@ impl Repo {
             let copy = dfd.try_clone();
             // Now release our temporary ownership of the original
             let _ = dfd.into_raw_fd();
-            Ok(copy?)
+            copy
         }
     }
 
index 84ef2f89aaca8ae7ada1542d446948418d2a9e2f..5255c28627647cf6ea24710a87d697f3a12a8e46 100644 (file)
@@ -49,7 +49,7 @@ impl SysrootBuilder {
     /// Perform common configuration steps, returning a not-yet-fully-loaded `Sysroot`.
     fn configure_common(self) -> Sysroot {
         let sysroot = {
-            let opt_file = self.path.map(|p| gio::File::for_path(p));
+            let opt_file = self.path.map(gio::File::for_path);
             Sysroot::new(opt_file.as_ref())
         };